package com.zxt.redis.utils;

import com.zxt.utils.StringUtils;

public class UserRedisKey {

    private static final String PREFIX  = "content:b:";

    /**
     * 获取图片验证码key
     *
     * @param key
     * @return
     */
    public static String getCodeKey(String key) {
        if (StringUtils.isEmpty(key)) {
            return "";
        }
        StringBuilder sbBuilder = new StringBuilder(80);
        sbBuilder.append(PREFIX);
        sbBuilder.append("captcha:code:");
        sbBuilder.append(key);
        return sbBuilder.toString();
    }


    /**
     * 登录用户 redis key
     *
     * @param token
     * @return
     */
    public static String getTokenKey(String token) {
        if (StringUtils.isEmpty(token)) {
            return "";
        }
        StringBuilder sbBuilder = new StringBuilder(80);
        sbBuilder.append(PREFIX);
        sbBuilder.append("user:token:");
        sbBuilder.append(token);
        return sbBuilder.toString();
    }


    /**
     * 获取短息redisKey
     *
     * @param key
     * @return
     */
    public static String getSendKey(String key) {
        if (StringUtils.isEmpty(key)) {
            return "";
        }
        StringBuilder sbBuilder = new StringBuilder(80);
        sbBuilder.append(PREFIX);
        sbBuilder.append("message:code:");
        sbBuilder.append(key);
        return sbBuilder.toString();
    }

}